In With arrays, why is it the case that a[5] == 5[a]? it is explained that the []
operator in a[5]
is defined as *(a + 5)
and because +
is commutative, 5[a]
means *(5 + a)
and so the two expressions refer to the same memory location. Fine.
However, C also defines in 6.4.2.1 that an identifier cannot start with a digit. In 5[a]
the array identifier is 5
which is not a valid identifier. Why does 5[a]
not generate an error about an invalid identifier?